﻿define(function (require) {
    var ProjectView = require('views/project.view');

    return Backbone.View.extend({
        tagName: "ul",
        events: {

    },

    initialize: function () {
        $(this.el).addClass('project-list ui-listview')
                  .attr({
                      "data-role": "listview",
                      "data-split-theme": "d"
                  });

        _.bindAll(this, 'addOne', 'render');
        this.model.bind('getAll', this.render);
    },
    render: function () {
        this.model.each(this.addOne);
        return this;
    },
    addOne: function (e) {
        var view = new ProjectView({ model: e });
        var element = view.render().el;
        $(this.el).append(element);
    },

    clear: function (e) {

    }

});

});